/**
 * Created by hjqi on 2016/6/02.
 */
module.controller('StorageDeleteController',
  function ($scope, $rootScope, $cookies, $q, $window, $stateParams, $uibModal, $state, storageService, k8sService, VolMgrConf, netTesting, svcCommonService,$mdDialog,params) {
    $scope.sName=params.ev.name;
      $scope.mountd=(params.ev.mountAppNameArray!= undefined&&params.ev.mountAppNameArray.length > 0)?true:false;
      $scope.ok=function () {
        storageService.deleteStorage(params.ev).then(function (ret) {
            if (ret.data.ret == true) {
                var _idx = params.storages.indexOf(params.ev);
                params.storages.splice(_idx, 1);
                alertify.success("delete volume success");
              $mdDialog.hide();
            }
        }, function (ret) {
            $mdDialog.hide();
            alertify.error("delete volume error:"+ret.data.error);
        });
    }
      $scope.cancel=function(){
          $mdDialog.cancel();
      };
  }
);